FROM nvidia/cuda:12.2.2-cudnn8-devel-centos7

# Set the locale
ENV  LANG="en_US.utf8"

# 安装依赖项
RUN yum install -y wget vim libXext libSM libXrender mesa-libGL && \
    yum clean all

# 安装Miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /miniconda.sh && \
    bash /miniconda.sh -b -p /miniconda && \
    rm /miniconda.sh
ENV PATH="/miniconda/bin:${PATH}"

# 创建并激活Python环境
RUN conda create -y -n ai python=3.11
ENV PATH="/miniconda/envs/ai/bin:${PATH}"
RUN echo "source activate ai" > ~/.bashrc
SHELL ["/bin/bash", "--login", "-c"]

RUN python -m pip install --upgrade pip

# 设置环境变量
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

WORKDIR /nlp

COPY . /nlp/

RUN pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple/

RUN chmod  +x startup.sh

ENTRYPOINT ["./startup.sh"]
